<?php
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/x-png")
|| ($_FILES["file"]["type"] == "image/png")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 100000))
  {
  if ($_FILES["file"]["error"] > 0)
    {
    echo "<script language=\"JavaScript\">alert(\"错误，请联系管理员！\");</script>";
    }
  else
    {
    if (file_exists("../css/images/" . $_FILES["file"]["name"]))
      {
      echo "<script language=\"JavaScript\">alert(\"文件已经存在，上传失败！\");</script>"; 
      }
    else
      {
	  require_once("../conn.php"); 
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "../css/images/" . $_FILES["file"]["name"]);
	  $src =  $_FILES["file"]["name"];
	  $title =  $_POST['title'];
	  $sql="insert into t_qianse_pic (src,title) values( '".$src."','".$title."' ) ";
	  echo "<script language='javascript'> alert('$sql');</script>"; 
	  $rs = mysql_query($sql);
	  echo "<script language=\"JavaScript\">alert(\"上传成功！\");</script>"; 
      }
    }
  }
?>